package ch11.home;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

class Exercise11_10 {
	public static void main(String[] args) {
		Set<Integer> set = new HashSet<Integer>();		
		for (int i = 0; set.size() < 25; i++)
			set.add((int)(Math.random() * 30) + 1 );
		ArrayList<Integer> list = new ArrayList<Integer>(set);
		Collections.shuffle(list);
		
		Iterator<Integer> it = list.iterator();
		int[][] board = new int[5][5];
		for (int i = 0; i < board.length; i++) {
			for (int j = 0; j < board[i].length; j++) {
				board[i][j] = it.next();
				System.out.print((board[i][j] < 10 ? "  " : " ") + board[i][j]);
			}
			System.out.println();
		}
	}
}
/*
 3 14 18  2 13
24  1 10 23 11
 4 29 21 15 30
 8  5  7 22  9
27 20 12 19 28
*/